<% @page_title = "Campaign Victims" %>

<%= link_to("<< Back to Campaign Options", campaign_path(id: params[:id]), :class => 'back-link') %>

<h3>Targets</h3>

<% unless @victims.empty? %>
  <div id="campaign-buttons">
    <%= button_to("Delete all", clear_victims_campaign_path(id: params[:id]), class: "btn btn-danger") %>
  </div>

  <% counter = 1 %>
  <table id="victims-table" class="table table-hover table-condensed">
    <tr>
      <th></th>
      <th>First</th>
      <th>Last</th>
      <th>Email</th>
      <th>UID</th>
      <th>Sent?</th>
      <th>Delete</th>
    </tr>
    <% @victims.each do |victim| %>
    <tr id="victim-<%= victim.id %>">
      <td>
        <%= counter %>
        <% counter += 1 %>
      </td>
      <td><%= victim.firstname %></td>
      <td><%= victim.lastname %></td>
      <td><%= victim.email_address %></td>
      <td><%= victim.uid %></td>
      <td><%= victim.sent %></td>
      <td>
        <%= link_to(image_tag('red_x.png', :size => '35x35'), {:controller => 'campaigns', :action => 'delete_victim', :id => victim.id, :method => 'delete', :remote => true}, id: "delete") %>
      </td>
    </tr>
    <% end %>
  </table>
<% end %>
